home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_319
/
cnewssrc
/
cnews.orig.lzh
/
relay
/
hdrdefs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-27
|
4KB
|
111 lines
/*
* Usenet header definitions (see ARPA Internet RFCs 1036 nee 850 & 822;
* for a second opinion, see The Hideous Name by Pike & Weinberger).
*
* Headers are parsed and modified and copied in one pass.
* Nevertheless, the code is in pieces: hdrdefs.c, hdrcommon.c,
* hdrparse.c, hdrmunge.c.
*/
#include <stdio.h>
#include <sys/types.h>
#ifdef REALSTDC
#include <stdlib.h>
#endif /* REALSTDC */
#include "news.h"
#include "headers.h"
#include "hdrint.h" /* may define "const" */
#ifndef offsetof
#define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL)
#endif
/* "mandatory" headers (also From:, Date:) */
static const char msgnm[] = "Message-ID:"; /* for rejection */
static const char ngsnm[] = "Newsgroups:"; /* filing, clone for Xref */
static const char pathnm[] = "Path:"; /* rejection, extend (damn) */
static const char subjnm[] = "Subject:"; /* for ctl. msgs. */
/* optional headers */
static const char appnm[] = "Approved:"; /* for mod. groups */
static const char ctlnm[] = "Control:"; /* ctl. msg. */
static const char expnm[] = "Expires:"; /* for history */
static const char distrnm[] = "Distribution:"; /* for transmission */
static const char sendnm[] = "Sender:"; /* for mod. groups */
static const char xrefnm[] = "Xref:"; /* to *replace* (damn!)*/
/* obsolete "useful" headers */
static const char artnm[] = "Article-I.D.:"; /* obs. Message-ID: */
/* obsolete useless headers: delete them all on contact */
static const char datercvnm[] = "Date-Received:";
static const char rcvnm[] = "Received:"; /* obsolete Date-Received: */
static const char postnm[] = "Posted:"; /* obsolete Date: */
static const char postversnm[] = "Posting-Version:";
static const char rlyversnm[] = "Relay-Version:";
static const char illobjnm[] = "Illegal-Object:"; /* zmailer bitching */
static const struct hdrdef msghdr = {
msgnm, STRLEN(msgnm), offsetof(struct headers, h_msgid) };
static const struct hdrdef ngshdr = {
ngsnm, STRLEN(ngsnm), offsetof(struct headers, h_ngs) };
const struct hdrdef pathhdr = {
pathnm, STRLEN(pathnm), offsetof(struct headers, h_path) };
static const struct hdrdef subjhdr = {
subjnm, STRLEN(subjnm), offsetof(struct headers, h_subj) };
static const struct hdrdef apphdr = {
appnm, STRLEN(appnm), offsetof(struct headers, h_approved) };
static const struct hdrdef ctlhdr = {
ctlnm, STRLEN(ctlnm), offsetof(struct headers, h_ctlcmd) };
static const struct hdrdef exphdr = {
expnm, STRLEN(expnm), offsetof(struct headers, h_expiry) };
static const struct hdrdef distrhdr = {
distrnm, STRLEN(distrnm), offsetof(struct headers, h_distr) };
static const struct hdrdef sendhdr = {
sendnm, STRLEN(sendnm), offsetof(struct headers, h_sender) };
const struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
static const struct hdrdef arthdr = {
artnm, STRLEN(artnm), offsetof(struct headers, h_artid) };
static const struct hdrdef datrcvhdr = { datercvnm, STRLEN(datercvnm), -1 };
static const struct hdrdef rcvhdr = { rcvnm, STRLEN(rcvnm), -1 };
static const struct hdrdef psthdr = { postnm, STRLEN(postnm), -1 };
static const struct hdrdef pstvrshdr = { postversnm, STRLEN(postversnm), -1 };
static const struct hdrdef rlyvrshdr = { rlyversnm, STRLEN(rlyversnm), -1 };
static const struct hdrdef illobjhdr = { illobjnm, STRLEN(illobjnm), -1 };
const hdrlist parsehdrs = { /* these are parsed into a struct headers */
&msghdr,
&arthdr, /* obsolete */
&ngshdr,
&pathhdr, /* modified by hdrmunge.c (emithdr()) */
&subjhdr,
/* start optional headers */
&apphdr,
&ctlhdr,
&distrhdr,
&exphdr,
&sendhdr,
NULL
};
/*
* the following noxious headers are deleted on contact because neighbours
* still send them and they are big. in an ideal world, they wouldn't be
* sent and thus we wouldn't need to delete them.
* It is tempting to delete Article-I.D.: too, but it may be too soon for that.
*/
const hdrlist hdrvilest = {
&xrefhdr, /* regenerated by fileart() if needed */
&datrcvhdr,
&rcvhdr,
&psthdr,
&pstvrshdr,
&rlyvrshdr,
&illobjhdr,
NULL,
};
boolean headdebug = NO;